use sgs_runtime::{pkg::*, *};

use crate::{LifeCycleDelegator, StartDelegator, StdDelegator, StdSetupDelegator};

/// 三国杀标准库
///
/// 自定义设置 Debug 模式
#[derive(Debug, Clone)]
pub struct Pkg {
    debug: bool,
}

impl Pkg {
    /// 创建 Debug 模式的 Pkg
    pub fn debug() -> Self {
        Self { debug: true }
    }

    /// 创建 Release 模式的 Pkg
    pub fn release() -> Self {
        Self { debug: false }
    }
}

impl Provide for Pkg {
    fn provide_package(&self) -> Package {
        let mut package = create_package! {
            version => "0.0.1",
            tag => "sgs_pkg_std",
            name => "三国杀标准包" ,
            desp => "三国杀官方标准包的 rust 实现",
            patterns =>  create_pattern![5, 8],
            cards => include!("../define/card.txt"),
            roles => include!("../define/role.txt"),
            delegators => make_delegators![StdSetupDelegator,  StartDelegator, StdDelegator],
        };

        if self.debug {
            package.add_delegators(LifeCycleDelegator);
        }

        package
    }
}
